﻿Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class General
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function XMLSTRINGFORMAT() As String
        Dim connect As New Connection()
        Try
            Dim ds As DataSet = connect.ObjectGetAll_Query_SAP("select top(2) itemcode, itemname from OITM")
            Return oXML.ToXMLStringFromDS("OBJTYPE TYPE", ds, False)
        Catch ex As Exception
            Return ex.ToString
        End Try
    End Function
    <WebMethod()> _
    Public Function _INITIAL_() As String
        Dim connect As New Connection()
        Try
            Dim ogen As New oGeneral
            Dim str As String = ogen.GenerateUDT_UDF()
            Return str
        Catch ex As Exception
            Return ex.ToString
        End Try
    End Function
    <WebMethod()> _
    Public Function _SET_CONNECTION_(ByVal SQLServer As String, ByVal SQLDBName As String, ByVal SQLUser As String, ByVal SQLPwd As String, ByVal SQLType As String, _
                                   ByVal SAPServer As String, ByVal SAPUser As String, ByVal SAPPwd As String) As String
        Dim connect As New Connection()
        Try
            Dim ogen As New oGeneral
            Dim str As String = ogen.SetConnection(SQLServer, SQLDBName, SQLUser, SQLPwd, SQLType, _
                                    SAPServer, SAPUser, SAPPwd)
            Return str
        Catch ex As Exception
            Return ex.ToString
        End Try
    End Function
    <WebMethod()> _
    Public Function _TEST_CONNECTION_() As String
        Dim connect As New Connection()
        Try
            Dim ogen As New oGeneral
            Dim str As String = ogen.TestConnection
            Return str
        Catch ex As Exception
            Return ex.ToString
        End Try
    End Function
End Class